﻿@using System.Threading
@model LanguageBarViewModel

<style>
	.dd-selected {
		padding: 5px;
	}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		$('#CurrentCulture').ddslick({
			width: 220,
			onSelected: function (selectedData) {
				if (selectedData.selectedData.value != "@Thread.CurrentThread.CurrentCulture.Name") {
					window.location.href = "@Url.Action("ChangeCulture", "Language")" + "?cultureName=" + selectedData.selectedData.value + "&returnUrl=" + "@Request.Url.PathAndQuery";
				}
			}
		});
	});
</script>

<div class="lang">
	<select id="CurrentCulture">
		@foreach (var item in Model.Cultures) {
			<option value="@item.Value" data-imagesrc="@Url.Content(item.Image)" @(Thread.CurrentThread.CurrentCulture.Name == item.Value ? "selected=selected" : string.Empty)>@item.Text</option>
		}
	</select>
</div>